package expressions.slogo;

import java.util.ArrayList;
import java.util.List;
import expressions.Operator;

public abstract class BooleanOperator extends Operator<Double>
{

    public BooleanOperator(int arguments)
    {
        super(arguments);
    }

    @Override
    protected Double combineResults(List<Double> results)
    {
        List<Boolean> booleans = new ArrayList<Boolean>();

        for (double result : results)
            booleans.add(BooleanConstant.toBoolean(result));

        return BooleanConstant.toDouble(combineBooleans(booleans));
    }

    protected abstract boolean combineBooleans(List<Boolean> results);

}
